<template>
  <div id="app">
    <!-- 渲染和配置路由所匹配的组件 -->
    <keep-alive include="Unknown,Share,Home" :max="3">
      <router-view v-if="isRouterAlive" />
    </keep-alive>
  </div>
</template>
<script>
export default {
  name: "app",
  provide() {
    return {
      reload: this.reload
    };
  },
  data() {
    return {
      isRouterAlive: true
    };
  },
  watch: {
    $route(to, from) {
      if (this.$route.name == "Detail") {
        window.location.reload();
      }
    }
  },
  methods: {
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(function() {
        this.isRouterAlive = true;
      });
    }
  }
};
</script>
<style scoped>
#app {
  overflow: hidden;
}
</style>
